Skip to content

ht4 done#43

Open
musiclover174 wants to merge 15 commits into
romabelka:masterfrom
musiclover174:master
Open

ht4 done#43
musiclover174 wants to merge 15 commits into
romabelka:masterfrom
musiclover174:master

Conversation

@musiclover174
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@romabelka romabelka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почитай, пожалуйста, слак. Выполняй домашку поверх моих изменений, проверить ДЗ из 29 измененных файлов невозможно. В следующий раз я не буду принимать в таком виде

handleAddComment = () => {
const { addComment, articleId } = this.props
addComment({
"user": this.refs.commentName.value,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не трогай ref без крайней необходимости. Храни значения в state

}

state = {
textIsEmpty: true,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем это?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у меня концептуально в форме кнопка "отправить" становится доступной только при заполнении обоих полей.
Для этого тут и работа с рефами, чтобы данные формы подтягивать и стейт текущего состояния инпутов и все такое прочее.
И обнуление заполненности полей через реф тоже за этим.)
Все равно неверно?)

"text": this.refs.commentText.value
}, articleId)

this.refs.commentName.value = ''
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не меняй ничего руками в DOM!

render() {
const { articles, selected } = this.props
const options = articles.map(article => ({
const options = Object.values(articles).map(article => ({
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше селектор, который достанет из в виде массива

const {type, payload} = action

switch (type){
case ADD_COMMENT:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

через мидлвары будет проходить каждый экшин, они должны быть максимально общими, завязывать на конкретные экшины - не лучшее решение


switch (type){
case ADD_COMMENT:
payload.comment.id = makeid()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше не мутировать payload, мало-ли что там станут передавать

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants